<?php
$q=$_GET["q"];
$hint='';
include_once ("../Login/databaseconnection.php");
require_once ("../Login/config.php");
$nam=explode(" ",$q);
$f_n=$nam[0];
$l_n=$nam[1];
$result = mysql_query("SELECT * FROM teacher Where First_Name='$f_n' AND Last_Name='$l_n'");
if($row = mysql_fetch_array($result))
{
$id=$row['T_NIC_Number'];
$sid=$row['School_Id'];
$resultsc = mysql_query("SELECT * FROM school Where School_Id='$sid'");
if(mysql_num_rows($resultsc)>0)
{
if($rowsc = mysql_fetch_array($resultsc))
{
$addr=$rowsc['Address'];
$na=$rowsc['Name'];
}
}
$hint="<br/><font color='black'>The NIC number of this Teacher is :".$id."<br/>";
$hint=$hint."<br/>To view all Training details of ";
$hint=$hint.'<a href="'.$basedir.'/Resourceteam/searchrest.php?action=teacher&t='.$id.'" class="searchlinks">'.$f_n.' '.$l_n;
if(mysql_num_rows($resultsc)==0)
{
$hint=$hint.' of '.$sid;
}
if(mysql_num_rows($resultsc)>0)
{
$hint=$hint.' of '.$na.' '.$addr;
}
$hint=$hint.'</a><br/>';
$resultrt = mysql_query("SELECT * FROM resource_team Where T_NIC_Number='$id'");
while($rowrt = mysql_fetch_array($resultrt))
{
$From_Date=$rowrt['From_Date'];
$Training_Id=$rowrt['Training_Id'];

$hint=$hint."<br/>To search all Resource persons From ";
$hint=$hint.'<a href="'.$basedir.'/Resourceteam/searchrest.php?action=fromdate&f='.$From_Date.'" class="searchlinks">'.$From_Date.' </a><br/>';
$resulttra = mysql_query("SELECT * FROM training Where Training_Id='$Training_Id'");
if($rowtra = mysql_fetch_array($resulttra))
{
$rowtra['Training_Name'];
$hint=$hint."<br/>To search all Resource persons who are Trained to ";
$hint=$hint.'<a href="'.$basedir.'/Resourceteam/searchrest.php?action=training&tra='.$rowtra['Training_Id'].'" class="searchlinks">'.$rowtra['Training_Name'].' </a><br/>';
}
}
$resultsch = mysql_query("SELECT * FROM school Where School_Id='$sid'");
if(mysql_num_rows($resultsch)>0)
{
if($rowsch = mysql_fetch_array($resultsch))
{
$cno=$rowsch['Census_Number'];
$nam=$rowsch['Name'];
$adr=$rowsch['Address'];
}
}
$hint=$hint."<br/>To view all Resource persons' details of ";
$hint=$hint.'<a href="'.$basedir.'/Resourceteam/searchrest.php?action=school&s='.$sid.'" class="searchlinks"> ';
if(mysql_num_rows($resultsch)==0)
{
$hint=$hint.$sid;
}
if(mysql_num_rows($resultsch)>0)
{
$hint=$hint.$nam.' '.$adr;
}
$hint=$hint.'</a><br/>';

$hint=$hint.'</font>';
}
if($hint==''||$hint=="<br/><font color='black'>The NIC number of this Teacher is :".$id."<br/></font>")
{
echo $hint."<br/>";
$response='<font class="err"><img src="../images/alert.jpg" width="12" height="12"/> There are no results found for this Training name!</font>';
}
else
{
$response=$hint;
}
echo $response;
?>